package com.cloud.xtools.module.controller.admin;

import com.cloud.xtools.common.controller.BaseController;
import com.cloud.xtools.common.response.ApiResponse;
import com.cloud.xtools.common.response.PageList;
import com.cloud.xtools.module.domain.query.admin.ModuleCollectionQuery;
import com.cloud.xtools.module.service.admin.ModuleCollectionService;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("api/module/admin")
@RequiredArgsConstructor
@Validated
public class ModuleCollectionController extends BaseController {

    private final ModuleCollectionService moduleCollectionService;

    @GetMapping("module-collections")
    public ApiResponse<PageList> list(@Valid @ModelAttribute ModuleCollectionQuery moduleCollectionQuery) {
        return success(moduleCollectionService.collectionList(moduleCollectionQuery));
    }
}
